const { request } = require('./request')
//const jwt = wx.getStorageSync('jwt');


module.exports = {
    //登录
    toLogin: (data) => {
        return request(`qmmh/hall/xcxlogin`, 'POST', data)
    },
    //设置手机号
    setPhone: (data) => {
        return request(`qmmh/hall/setphone`, 'GET', data)
    },
    getPhone: (data) => {
        const jwt = wx.getStorageSync('jwt');
        return request(`qmmh/hall/getuserphonenumber?jwt=${jwt}`, 'POST', data)
    },
    //二维码获取产品信息
    codeProduction: (data) => {
        return request('code/code', 'GET', data)
    },
    //二维码核销
    codeWriteoff: (data) => {
        const jwt = wx.getStorageSync('jwt');
        return request(`code/writeoff?jwt=${jwt}`, 'GET', data)
    },
    //首页轮播图
    bannerList: (data) => {
        return request(`qmmh/hall/banner`, 'GET', data)
    },
    //图鉴列表
    picList: (data) => {
        return request(`qmmh/hall/series`, 'GET', data)
    },

    //规则   规则说明类型(1签到规则 2签到攻略 3分享规则 4活动规则 5兑换说明 6图鉴说明 s7协议与规则)
    ruleList: (data) => {
        return request(`qmmh/hall/rule`, 'GET', data)
    },

    //首页公告弹窗
    noticeDialog: (data) => {
        return request(`qmmh/hall/notice`, 'GET', data)
    },

    //设置年龄
    setAge: (data) => {
        const jwt = wx.getStorageSync('jwt');
        return request(`qmmh/hall/setage?jwt=${jwt}`, 'GET', data)
    },

    //签到首页
    getSignData: (data) => {
        const jwt = wx.getStorageSync('jwt');
        return request(`qmmh/hall/signindex?jwt=${jwt}`, 'GET', data)
    },

    //去签到
    toSign: (data) => {
        const jwt = wx.getStorageSync('jwt');
        return request(`qmmh/hall/sign?jwt=${jwt}`, 'GET', data)
    },

    //领取任务
    getTask: (data) => {
        const jwt = wx.getStorageSync('jwt');
        return request(`qmmh/hall/taskreceive?jwt=${jwt}`, 'GET', data)
    },

    //关注公众号
    guanzhu: (data) => {
        const jwt = wx.getStorageSync('jwt');
        return request(`qmmh/hall/guanzhu?jwt=${jwt}`, 'GET', data)
    },


    //邀请好友
    shareFriend: (data) => {
        const jwt = wx.getStorageSync('jwt');
        return request(`qmmh/hall/friends?jwt=${jwt}`, 'GET', data)
    },


    //用户信息
    getUser: (data) => {
        const jwt = wx.getStorageSync('jwt');
        return request(`qmmh/hall/getuserinfo?jwt=${jwt}`, 'GET', data)
    },

    //传头像
    uploadImg: (data) => {
        return request(`qmmh/hall/upload`, 'POST', data)
    },


    //地址相关接口-------------
    //新增地址
    addAddress: (data) => {
        const jwt = wx.getStorageSync('jwt');
        return request(`qmmh/hall/addaddress?jwt=${jwt}`, 'POST', data)
    },

    //地址列表
    getAdd: (data) => {
        const jwt = wx.getStorageSync('jwt');
        return request(`qmmh/hall/addresslist?jwt=${jwt}`, 'GET', data)
    },

    //获取地址信息
    getItemAdd: (data) => {
        const jwt = wx.getStorageSync('jwt');
        return request(`qmmh/hall/getaddressbyid?jwt=${jwt}`, 'GET', data)
    },

    //修改地址
    editAdd: (data) => {
        const jwt = wx.getStorageSync('jwt');
        return request(`qmmh/hall/changeaddress?jwt=${jwt}`, 'POST', data)
    },

    //删除地址
    delAdd: (data) => {
        const jwt = wx.getStorageSync('jwt');
        return request(`qmmh/hall/deladdress?jwt=${jwt}`, 'GET', data)
    },

    //设置默认地址
    setDefAdd: (data) => {
        const jwt = wx.getStorageSync('jwt');
        return request(`qmmh/hall/setdefaddress?jwt=${jwt}`, 'GET', data)
    },

    //商品相关接口---------
    goodList: (data) => {
        return request(`goodsorder/goodslist`, 'GET', data)
    },

    //商品详情
    goodDetail: (data) => {
        return request(`goodsorder/goodsdetails`, 'GET', data)
    },

    //订单详情
    orderDetail: (data) => {
        const jwt = wx.getStorageSync('jwt')
        return request(`goodsorder/getorderinfo?jwt=${jwt}`, 'GET', data)
    },
    //确认兑换
    sureChange: (data) => {
        const jwt = wx.getStorageSync('jwt')
        return request(`goodsorder/exchange?jwt=${jwt}`, 'GET', data)
    },

    //订单列表
    orderList: (data) => {
        const jwt = wx.getStorageSync('jwt')
        return request(`goodsorder/orderlist?jwt=${jwt}`, 'GET', data)
    },

    //订单详情
    orderInfo: (data) => {
        const jwt = wx.getStorageSync('jwt')
        return request(`goodsorder/orderdetails?jwt=${jwt}`, 'GET', data)
    },

    //确认收货
    sureOrder: (data) => {
        const jwt = wx.getStorageSync('jwt')
        return request(`goodsorder/confirmreceipt?jwt=${jwt}`, 'GET', data)
    },

    //积分列表
    pointList: (data) => {
        const jwt = wx.getStorageSync('jwt')
        return request(`qmmh/hall/scorechangelog?jwt=${jwt}`, 'GET', data)
    },

    //图鉴详情
    skuDetail: (data) => {
        const jwt = wx.getStorageSync('jwt')
        return request(`code/getskusbyseriesnum?jwt=${jwt}`, 'GET', data)
    },

    //二维码获取产品信息
    getCode: (data) => {
        return request(`code/code`, 'GET', data)
    },

    //核销
    writeOffPic: (data) => {
        const jwt = wx.getStorageSync('jwt')
        return request(`code/writeoff?jwt=${jwt}`, 'GET', data)
    },

    //海报列表
    posterList: (data) => {
        const jwt = wx.getStorageSync('jwt')
        return request(`code/sortskulist?jwt=${jwt}`, 'GET', data)
    },

    //图鉴海报领奖
    picPoster: (data) => {
        const jwt = wx.getStorageSync('jwt')
        return request(`code/receiveseries?jwt=${jwt}`, 'GET', data)
    },

    //分享操作
    toShare: (data) => {
        const jwt = wx.getStorageSync('jwt')
        return request(`qmmh/hall/share?jwt=${jwt}`, 'GET', data)
    },

    //记录打开小程序
    openMini: (data) => {
        const jwt = wx.getStorageSync('jwt')
        return request(`qmmh/hall/addnum?jwt=${jwt}`, 'GET', data)
    },
}